package cn.org.xiaosheng.okhttp;

import cn.org.xiaosheng.okhttp.utils.GetOkHttpUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author XiaoSheng
 * @date 2023-11-17
 * @dec 描述
 */
@RestController
@Slf4j
public class GetOkHttpTest {

    @Resource
    private GetOkHttpUtils getOkHttpUtils;

    @RequestMapping("/testOkGet")
    public String testOkGet() {
        Map<String, String> headers = new HashMap<>();
        headers.put("tenant-id", "1");
        headers.put("Authorization", "Bearer test1");
        headers.put("client-type", "web");
        headers.put("Conten-Type", "x-www-form-urlencoded");
        Map<String, String> params = new HashMap<>();
        params.put("pageNo", "1");
        params.put("pageSize", "10");
        String response = getOkHttpUtils.getRequest("http://xxxxxxx:7024/admin-api/operate/project-list/names", headers, params);
        log.info("response:{}", response);
        //log.info("response:{}", responseAsyn);
        return response;
    }


}
